﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using Sirenix.OdinInspector;
using UnityEditor;
using UnityEngine;

namespace BearUtil
{
    public class ActorData : ScriptableObject
    {
        // external data 
        [HideLabel, PreviewField(55, ObjectFieldAlignment.Center), VerticalGroup("编辑器数据")]
        public Texture Icon;

        // 用于选项
        [HideLabel, VerticalGroup("编辑器数据")]
        private string uniqueId;

        /// <summary>
        /// 角色 id
        /// </summary>
        [LabelText("角色 id"), VerticalGroup("基础数据")]
        public int role_id;

        /// <summary>
        /// 检索音效关键字，用于 AudioClip 检索时指定角色音色
        /// </summary>
        [LabelText("检索音效关键字"), ValueDropdown("getVoiceType")]
        public string voice_type;

        private List<string> getVoiceType()
        {
            return ActorsOverview.Instance.VoiceTypes;
        }

        /// <summary>
        /// 立绘参考资源
        /// </summary>
        [LabelText("立绘资源"), VerticalGroup("基础数据")]
        public string[] icon_portrait;

        [LabelText("首选名选择"), VerticalGroup("基础数据")]
        public string[] role_names;

        [HorizontalGroup("功能"), Button("删除"), TableColumnWidth(50)]
        public void RemoveSelf()
        {
            ActorsOverview.Instance.actors.Remove(this);
            this.DeleteSelf();
        }

        [ReadOnly, HideLabel, VerticalGroup("编辑器数据")]
        public string fileName;
        public void OnEnable()
        {
            fileName = name;
        }
    }
}